package com.rizzo.android.domain;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;
import java.util.Date;

@DatabaseTable(tableName = PerformanceData.TABLE_NAME)
public class PerformanceData implements Serializable {

	public static final String TABLE_NAME = "performance_data";
	public static final String ID_FIELD = "_id";
	public static final String TIME_FIELD = "time";
	public static final String DURATION_FIELD = "duration";
	public static final String PERFORMANCE_FK_FIELD = "performance_fk";
	public static final String[] AVAILABLE_FIELDS = {ID_FIELD, TIME_FIELD, DURATION_FIELD, PERFORMANCE_FK_FIELD};

	@DatabaseField(id = true, columnName = ID_FIELD, generatedId = true)
	private long id;

	@DatabaseField(canBeNull = false, columnName = TIME_FIELD)
	private Date time;

	@DatabaseField(canBeNull = false, columnName = DURATION_FIELD)
	private double duration;

	@DatabaseField(canBeNull = false, foreign = true, columnName = PERFORMANCE_FK_FIELD)
	private Performance performance;

	public PerformanceData() {
	}

	public PerformanceData(Performance performance, Date time, double duration) {
		this.performance = performance;
		this.duration = duration;
		this.time = time;
	}

	public double getDuration() {
		return duration;
	}

	public void setDuration(double duration) {
		this.duration = duration;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Performance getPerformance() {
		return performance;
	}

	public void setPerformance(Performance performance) {
		this.performance = performance;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
}
